﻿using FluentValidation.Attributes;
using Nop.Admin.Models.Common;
using Nop.Admin.Validators.Customers;
using Nop.Web.Framework;
using Nop.Web.Framework.Mvc;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace Nop.Admin.Models.Customers
{
	[Validator(typeof(CustomerValidator))]
	public partial class CustomerModel : BaseNopEntityModel
	{
		public CustomerModel()
		{
			this.SelectedCustomerRoleIds = new List<int>();
			this.AvailableCustomerRoles = new List<SelectListItem>();
			this.AvailableDepartments = new List<SelectMenuModel>();
			this.CustomerHours = new CustomerHoursModel();
		}
		[NopResourceDisplayName("用户名", true)]
		[AllowHtml]
		public string Username { get; set; }


		[NopResourceDisplayName("Admin.Customers.Customers.Fields.Password")]
		[AllowHtml]
		[DataType(DataType.Password)]
		[NoTrim]
		public string Password { get; set; }


		//form fields & properties
		public bool GenderEnabled { get; set; }
		[NopResourceDisplayName("Admin.Customers.Customers.Fields.Gender")]
		public string Gender { get; set; }
		[NopResourceDisplayName("姓名", true)]
		[AllowHtml]
		public string TrueName { get; set; }
		[NopResourceDisplayName("Admin.Customers.Customers.Fields.FullName")]
		public string FullName { get; set; }

		[NopResourceDisplayName("联系方式")]
		public string TelPhone { get; set; }

		public bool DateOfBirthEnabled { get; set; }
		[UIHint("DateNullable")]
		[NopResourceDisplayName("Admin.Customers.Customers.Fields.DateOfBirth")]
		public DateTime? DateOfBirth { get; set; }


		[NopResourceDisplayName("Admin.Customers.Customers.Fields.RegisteredInStore")]
		public string RegisteredInStore { get; set; }



		[NopResourceDisplayName("Admin.Customers.Customers.Fields.AdminComment")]
		[AllowHtml]
		public string AdminComment { get; set; }

		[NopResourceDisplayName("Admin.Customers.Customers.Fields.Active")]
		public bool Active { get; set; }


		//registration date
		[NopResourceDisplayName("Admin.Customers.Customers.Fields.CreatedOn")]
		public DateTime CreatedOn { get; set; }
		[NopResourceDisplayName("Admin.Customers.Customers.Fields.LastActivityDate")]
		public DateTime LastActivityDate { get; set; }

		//IP adderss
		[NopResourceDisplayName("Admin.Customers.Customers.Fields.IPAddress")]
		public string LastIpAddress { get; set; }


		[NopResourceDisplayName("Admin.Customers.Customers.Fields.LastVisitedPage")]
		public string LastVisitedPage { get; set; }


		[NopResourceDisplayName("部门", true)]
		[UIHint("SelectMenu")]
		public int DepartmentId { get; set; }

		[NopResourceDisplayName("部门", true)]
		public string DepartmentName { get; set; }

		[NopResourceDisplayName("班组", true)]
		public string TeamName { get; set; }

		//customer roles
		[NopResourceDisplayName("Admin.Customers.Customers.Fields.CustomerRoles")]
		public string CustomerRoleNames { get; set; }
		/// <summary>
		/// 角色
		/// </summary>
		public List<SelectListItem> AvailableCustomerRoles { get; set; }
		/// <summary>
		/// 部门
		/// </summary>
		public List<SelectMenuModel> AvailableDepartments { get; set; }

		[NopResourceDisplayName("角色", true)]
		[UIHint("MultiSelect")]
		public IList<int> SelectedCustomerRoleIds { get; set; }

		public CustomerHoursModel CustomerHours { get; set; }

		#region Nested classes

		public partial class StoreModel : BaseNopEntityModel
		{
			public string Name { get; set; }
		}

		public partial class AssociatedExternalAuthModel : BaseNopEntityModel
		{
			[NopResourceDisplayName("Admin.Customers.Customers.AssociatedExternalAuth.Fields.Email")]
			public string Email { get; set; }

			[NopResourceDisplayName("Admin.Customers.Customers.AssociatedExternalAuth.Fields.ExternalIdentifier")]
			public string ExternalIdentifier { get; set; }

			[NopResourceDisplayName("Admin.Customers.Customers.AssociatedExternalAuth.Fields.AuthMethodName")]
			public string AuthMethodName { get; set; }
		}

		public partial class RewardPointsHistoryModel : BaseNopEntityModel
		{
			[NopResourceDisplayName("Admin.Customers.Customers.RewardPoints.Fields.Store")]
			public string StoreName { get; set; }

			[NopResourceDisplayName("Admin.Customers.Customers.RewardPoints.Fields.Points")]
			public int Points { get; set; }

			[NopResourceDisplayName("Admin.Customers.Customers.RewardPoints.Fields.PointsBalance")]
			public string PointsBalance { get; set; }

			[NopResourceDisplayName("Admin.Customers.Customers.RewardPoints.Fields.Message")]
			[AllowHtml]
			public string Message { get; set; }

			[NopResourceDisplayName("Admin.Customers.Customers.RewardPoints.Fields.Date")]
			public DateTime CreatedOn { get; set; }
		}


		public partial class ActivityLogModel : BaseNopEntityModel
		{
			[NopResourceDisplayName("Admin.Customers.Customers.ActivityLog.ActivityLogType")]
			public string ActivityLogTypeName { get; set; }
			[NopResourceDisplayName("Admin.Customers.Customers.ActivityLog.Comment")]
			public string Comment { get; set; }
			[NopResourceDisplayName("Admin.Customers.Customers.ActivityLog.CreatedOn")]
			public DateTime CreatedOn { get; set; }
			[NopResourceDisplayName("Admin.Customers.Customers.ActivityLog.IpAddress")]
			public string IpAddress { get; set; }
		}

		public partial class CustomerAttributeModel : BaseNopEntityModel
		{
			public CustomerAttributeModel()
			{
				Values = new List<CustomerAttributeValueModel>();
			}

			public string Name { get; set; }

			public bool IsRequired { get; set; }

			/// <summary>
			/// Default value for textboxes
			/// </summary>
			public string DefaultValue { get; set; }

			public IList<CustomerAttributeValueModel> Values { get; set; }

		}

		public partial class CustomerAttributeValueModel : BaseNopEntityModel
		{
			public string Name { get; set; }

			public bool IsPreSelected { get; set; }
		}
		public class CustomerHoursModel : BaseNopEntityModel
		{
			public CustomerHoursModel()
			{
				this.AvailableMonths = new List<SelectListItem>();
			}
			public int CustomerId { get; set; }
			/// <summary>
			/// 年
			/// </summary>
			[NopResourceDisplayName("年", true, "选择年，为0时为所有年")]
			public int Year { get; set; }
			/// <summary>
			/// 月
			/// </summary>
			[NopResourceDisplayName("月", true, "选择月，为0时为所有月")]
			public int Month { get; set; }
			/// <summary>
			/// 总工时
			/// </summary>
			[NopResourceDisplayName("工时", true, "月度总工时")]
			public decimal Hours { get; set; }
			public IList<SelectListItem> AvailableMonths { get; set; }
		}

		#endregion
	}
}